$.fn.drag = function(){
	/*设置元素定位属性*/
	var $this = this;
	$this.css("position","fixed");
	/*改变鼠标为移动样式*/
	if($this.find(":eq(0)")){
		$this.find(":eq(0)").css("cursor","move");
	}else{
		$this.css("cursor","move");
	}
	$this.find(":eq(0)").css("cursor","move");
	/*绑定鼠标点下事件*/
	$this.find(":eq(0)").mousedown(function(e){
		/*获取元素在页面的位置*/
		var left = $this.offset().left;
		var top = $this.offset().top;
		/*获取鼠标当前的位置*/
		var e_left = e.pageX;
		var e_top = e.pageY;
		/*坐标差*/
		var _left = sub([e_left,left]);
		var _top = sub([e_top,top]);
		
		/*鼠标移动*/
		$(document).mousemove(function(ev){
			/*获取鼠标移动过程中的坐标*/
			var e_moveLeft = ev.pageX;
			var e_moveTop = ev.pageY;
			
			/*计算新的坐标*/
			var newTop = e_moveTop-20//sub([e_moveTop,_top]);
			var newLeft = sub([e_moveLeft,_left]);
			$this.css({"top":newTop+"px","left":newLeft+"px"});
			
			/*鼠标弹起*/
			$(document).mouseup(function(){
				$this.css("position","default");
				$(document).unbind("mousemove");
			})
		})
	})
}
